//
//  CycleBaseView.h
//  CycleBaseControl
//
//  Created by ddy on 2018/8/14.
//  Copyright © 2018年 cycle. All rights reserved.
//  view基类

#import <UIKit/UIKit.h>
//倒入CycleBaseViewModel的协议
@protocol CycleBaseViewModelProtocol;

@protocol CycleBaseViewProtocol<NSObject>
@optional;
///初始化
- (instancetype)initWithViewModel:(id<CycleBaseViewModelProtocol>)viewModel;
///设置子控件
- (void)cycle_view_setupSubViews;
///绑定数据
- (void)cycle_view_bindData;
@end
@interface CycleBaseView : UIView<CycleBaseViewProtocol>
/*
 explain:
 在controller里面初始化view的时候可以传入viewmodel
 如:继承自CycleBaseView的myview在controller里面初始化的时候[[myview alloc]initWithViewModel:self.viewmodel],myview里面
 @property (nonatomic,strong)myViewModel *viewModel;

 同时初始化一个viewmodel叫myViewModel,同时在viewwillAppear里面执行数据[self.viewmode.command execute:nil],传入到view里面的时候,myview里面调用
 - (instancetype)initWithViewModel:(id<cycleBaseViewModelProtocol>)viewmodel {
 _viewmodel = (myViewModel *)viewmodel;
 return [super initWithViewModel:viewmodel];
 }
 接着如果myview里面有个控件为nameLabel,可以直接nameLabel.text = self.viewmode.name;//前提是name是你拿到的数据,在controller的[self.viewmode.command execute:nil]执行时拿到的
 */
@end
